package com.ziyear.dao;

import com.ziyear.domain.TrainSeat;

import java.sql.SQLException;
import java.util.List;

/**
 * 功能描述 : 列车座位持久层
 *
 * @author Ziyear
 */
public interface TrainSeatDao {

    /**
     * 添加车次
     *
     * @return 返回1为添加成功
     * @throws SQLException
     */
    int add(TrainSeat trainSeat) throws SQLException;

    /**
     * 删除车次对应座位 释放
     *
     * @return 返回1为删除成功
     * @throws SQLException
     */
    int delete(Integer trainId) throws SQLException;

    int occupySeat(Integer seatId) throws SQLException;

    int freed(Integer seatId) throws SQLException;

    List<TrainSeat> queryUnUsedByTrainAndType(Integer trainId, String carsType) throws SQLException;

    List<TrainSeat> queryUnUsedByTrainAndTypeAndCode(Integer trainId, String carsType, String seatCode) throws SQLException;

    TrainSeat queryByIdAndLock(Integer seatId) throws SQLException;

    void add(List<TrainSeat> trainSeats) throws SQLException;
}
